import type { PageParam, PageResult } from '@vben/request';
import type { Dayjs } from 'dayjs';

import { requestClient } from '#/api/request';

export namespace BaseinfoContractApi {
  /** 合同信息信息 */
  export interface BaseinfoContract {
    id: number; // 序号
    chatNo: number; // 回话编号
    chatName: string; // 回话主题
    contractHead: string; // 合同标题
    contractResume: string; // 合同摘要
    tempFile: string; // 合同模板
    status: string; // 状态
    flag: boolean; // 1新增2更新3删除
  }
}

/** 查询合同信息分页 */
export function getBaseinfoContractPage(params: PageParam) {
  return requestClient.get<PageResult<BaseinfoContractApi.BaseinfoContract>>('/csyt/baseinfo-contract/page', { params });
}

/** 查询合同信息详情 */
export function getBaseinfoContract(id: number) {
  return requestClient.get<BaseinfoContractApi.BaseinfoContract>(`/csyt/baseinfo-contract/get?id=${id}`);
}

/** 新增合同信息 */
export function createBaseinfoContract(data: BaseinfoContractApi.BaseinfoContract) {
  return requestClient.post('/csyt/baseinfo-contract/create', data);
}

/** 修改合同信息 */
export function updateBaseinfoContract(data: BaseinfoContractApi.BaseinfoContract) {
  return requestClient.put('/csyt/baseinfo-contract/update', data);
}

/** 删除合同信息 */
export function deleteBaseinfoContract(id: number) {
  return requestClient.delete(`/csyt/baseinfo-contract/delete?id=${id}`);
}

/** 批量删除合同信息 */
export function deleteBaseinfoContractList(ids: number[]) {
  return requestClient.delete(`/csyt/baseinfo-contract/delete-list?ids=${ids.join(',')}`)
}

/** 导出合同信息 */
export function exportBaseinfoContract(params: any) {
  return requestClient.download('/csyt/baseinfo-contract/export-excel', params);
}

